import yaml

class Mirror:
    def __init__(self, config):
        self.config = config
        self.settings = config['settings']
        self.master = self.settings['master']
        self.sts = self.settings['sts']
        self.usbl = self.settings['usbl']
        self.underwater = self.settings['underwater']
        self.water = self.settings['water']
        self.u_flash = self.settings['u_flash']

    def query(self, section, k):
        if section == "master":
            return self.master[k]
        if section == "sts":
            return self.sts[k]
        if section == "usbl":
            return self.usbl[k]
        if section == "underwater":
            return self.underwater[k]
        if section == "water":
            return self.water[k]
        if section == "u_flash":
            return self.u_flash[k]


if __name__ == '__main__':
    with open("../configs/settings.yaml", "r", encoding="utf-8") as f:
        config = yaml.safe_load(f)

    mirror = Mirror(config)
    v = mirror.query("sts", 'id')
    print(v)
    v = mirror.query("sts", 'digit_numbers')
    print(v)